//
// Created by root on 24-7-11.
//
#include "../include/io.h"
void init_position();
extern int current_print_position;
void rollup() {
    char * row = (char *)(0xb8000+160);
    for (int i = 0; i < 24; ++i) {
        for (int j = 0; j < 80; ++j) {
            *(row-160+j*2)=*(row+j*2);
            *(row-160+j*2+1) = 0xf;
        }
        row+=160;
    }
    row = (char *)current_print_position;
    for (int i = 0; i < 80; ++i) {
        *(row+i*2) = ' ';
        *(row+i*2+1) = 0xf;
    }

}

void movcursor(int rowoffset,int coloffset) {
    int position = rowoffset*80+coloffset;
    outbyte(0x3d4,0xf);
    outbyte(0x3d5,(char)position&0xff);
    outbyte(0x3d4,0xe);
    outbyte(0x3d5,(char)(position>>8)&0xFF);
}
